Skip to content

fix: avoid duplicate component PATCHes and skip unchanged components in deploy (SIR-2552) - #89

Merged
KeinerM merged 1 commit into
masterfrom
keinermartinez/sir-2552-bug-component-bundle-built-mid
Dec 3, 2026
Merged

KeinerM merged 1 commit into
masterfrom
keinermartinez/sir-2552-bug-component-bundle-built-mid

Conversation

@KeinerM

@KeinerM KeinerM commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Reduces unnecessary component saves and eliminates concurrent duplicate PATCH requests during raisely deploy, addressing the CLI-side contributor to SIR-2552.

Changes

  • src/deploy.js:
    • Removed the redundant updateComponentConfig(data) call during deploy. Previously deploy enqueued both updateComponentConfig(data) and updateComponentFile(data) concurrently for every component even though updateComponentFile already sends both latestHtml and latestSchema (including editable: config.fields), causing concurrent PATCH /v3/components/{uuid}?private=1 requests to race on latestVersion and double compiles and Cloudflare cache purges.
    • Now enqueues a single updateComponentFile(data, { skipUnchanged: true }) call per component and reports uploaded vs. skipped unchanged components.
  • src/actions/components.js:
    • Added hasComponentChanged(remoteComponent, { file, config }) comparing latestHtml and latestSchema.data.editable (via lodash.isEqual).
    • Updated updateComponentFile to support { skipUnchanged: true }, returning { skipped: true } without sending a PATCH when remote matches local.
    • Kept updateComponentConfig exported for src/start.js compatibility.
  • tests/components.test.js & tests/deploy.test.js:
    • Added unit tests for hasComponentChanged, updateComponentFile with { skipUnchanged: true }, and deploy component skipping/reporting.

Verification

  • npm test (vitest run --config vitest.config.js): 14/14 test files, 133/133 tests passing.
  • Verified locally against a local Raisely API:
    • raisely deploy with no changes skips all components (0 PATCH requests).
    • Editing 1 component's .js or .json (fields) sends a single PATCH for that component and skips the rest.
    • raisely start continues to save .js and .json changes without regression.

Note

Low Risk
Deploy path optimization with preserved start/watch behavior; behavior change is fewer API writes when content is unchanged.

Overview
Deploy now uploads each local component with a single updateComponentFile(..., { skipUnchanged: true }) instead of racing concurrent updateComponentConfig and updateComponentFile PATCHes. The CLI compares remote latestHtml and editable schema fields to local files and skips PATCHes when nothing changed, with progress text for uploaded vs skipped counts.

hasComponentChanged (lodash deep-equal on config.fields) gates that skip behavior; updateComponentConfig remains for raisely start watch flows. Tests cover change detection, skip-on-match, and deploy reporting.

Reviewed by Cursor Bugbot for commit b4f4536. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Risk: low. This automation approved the PR. The change is a bounded CLI deploy optimization (one PATCH per component, skip when remote HTML and editable fields match) with tests covering skip and upload reporting, and no Tier 1 issues.

Risk Assessment (Framework v2.0)

Framework (v2.0)

Dimension Tier Score Rationale
Security 1 Low No findings
Sensitive domains 1 Low None. CLI component upload path only; no auth, payments, PII storage, infra, CI/CD, or secrets changes
Data integrity 1 Low No data-access or org-scoping changes
Deployment 1 Low None
Scope 2 Medium Modifications in existing files (~242/18) plus tests; core logic change is small
Architecture 2 Low Stays in CLI component/deploy modules; updateComponentConfig remains for start/watch
Feature flags 2 Low CLI tooling behavior; production feature-flag wrap is unnecessary
Dependencies 2 Low No changes; reuses existing lodash

Mitigating Factors

  • Unit tests cover hasComponentChanged, skip-on-match, PATCH-when-changed, and deploy skip reporting
  • Skip compares the same latestHtml and editable fields the PATCH writes
  • raisely start still uses the previous config/file update path

Findings

# Finding Status Resolution

Outstanding findings: 0
Overall risk: LOW
Decision: APPROVED
Rationale: All Tier 1 dimensions are Low, outstanding findings is 0, and the deploy skip path is covered by tests. Approving under decision rule 4.

Open in Web View Automation 

Sent by Cursor Approval Agent: Nemo - Pull Request Router and Approver

@KeinerM
KeinerM merged commit 6548b72 into master Dec 3, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants